<?php
class IndexAction extends BaseAction {
               

	function index() {
	 //  $_SESSION['openid']=isset($_GET['openid'])?$_GET['openid']:$_SESSION['openid']; 
	// $_SESSION['openkey']=isset($_GET['openkey'])?$_GET['openkey']:$_SESSION['openkey'];
	  // $this->getmall_order();
	  header("Content-type:text/html; charset=UTF-8");
	  // $this->get59miaoshop();
	  //$this->assign(mall,$this->mall); 
	//   $this->get59miaoallshop();
	  
		$this->display();
		}
   
   
   //59miao 商城
   function get59miaoshop()
   {
   
	//$fields = 'sid,name,desc,shop_cat,logo,created,modified,click_url,cashback,payment,shipment,shipment_fee,cash_ondelivery,freeshipment,installment,has_invoice,status';
	
	
	/*
	* ListShopsDetail($sids, $fields = null)
	 * $sids 商家id  14929
	 * $fields 可传入的参数
	 * */
	 // click_url logo
	//$Api59miaoData=$this->api59miao->ListShopsDetail($_POST['shopid'],$fields);
	$fileds="sid,name,desc,shop_cat,logo,created,modified,click_url,cashback,payment,shipment,shipment_fee,cash_ondelivery,freeshipment,installment,has_invoice,status";
/*
 * $params可选参数 
 * page_no页数
 * page_size每页显示的数量   
 * cid 可选参数  表示查询指定类别的商品的所有商家信息   cid=15表示出售钟表眼镜的商家的信息
 * */
 $str='{';
	for($i=1;$i<10;$i++){
	$Api59miaoData= Array();
$params=Array('page_no' => $i, 'page_size' => 40,'cid'=>$_POST['mall_typeid']);   
//$Api59miaoData=$api59miao->ShopListGet($fileds);  //$params不传参数 
$Api59miaoData=$this->api59miao->ListShopListGet($fileds,$params);


			
				foreach($Api59miaoData['shops']['shop'] as $k => $v)
				{  
				   $str.='"'.$v['sid'].'":{"name":"'.$v['name'].'","url":"'.$v['click_url'].'","img":"'.$v['logo'].'"},'.PHP_EOL;
				
				}
				}
				$str=substr($str,0,strlen($str)-strlen(PHP_EOL)-1);
				$str.='}';
       file_put_contents("public/mall/".$_POST['mallbm'].".html",$str);
       //print_r($Api59miaoData);
               //file_put_contents("0.txt",$Api59miaoData[
    $this->ajaxReturn("","","");
   }
   
  function get59miaoallshop()
   {
   
	//$fields = 'sid,name,desc,shop_cat,logo,created,modified,click_url,cashback,payment,shipment,shipment_fee,cash_ondelivery,freeshipment,installment,has_invoice,status';
	
	
	/*
	* ListShopsDetail($sids, $fields = null)
	 * $sids 商家id  14929
	 * $fields 可传入的参数
	 * */
	 // click_url logo
	//$Api59miaoData=$this->api59miao->ListShopsDetail($_POST['shopid'],$fields);
	$fileds="sid,name,desc,shop_cat,logo,created,modified,click_url,cashback,payment,shipment,shipment_fee,cash_ondelivery,freeshipment,installment,has_invoice,status";
/*
 * $params可选参数 
 * page_no页数
 * page_size每页显示的数量   
 * cid 可选参数  表示查询指定类别的商品的所有商家信息   cid=15表示出售钟表眼镜的商家的信息
 * */
 
 	$str='{';
	for($i=1;$i<11;$i++){
	
	$Api59miaoData= Array();
  $params=Array('page_no' =>$i, 'page_size' =>40,'cid'=>0);   
//$Api59miaoData=$this->api59miao->ShopListGet($fileds);  //$params不传参数 
$Api59miaoData=$this->api59miao->ListShopListGet($fileds,$params);


			
				foreach($Api59miaoData['shops']['shop'] as $k => $v)
				{  
				  //if(strstr($str,$v['sid'])==false)
				 // {
				   $str.='"'.$v['sid'].'":{"name":"'.$v['name'].'","url":"'.$v['click_url'].'","img":"'.$v['logo'].'"},'.PHP_EOL;
				 // }
				}
				}
				
				$str=substr($str,0,strlen($str)-strlen(PHP_EOL)-1);
				$str.='}';
       file_put_contents("public/mall/".qbsj.".html",$str);
       //print_r($Api59miaoData);
               //file_put_contents("0.txt",$Api59miaoData[
    $this->ajaxReturn("","","");
	
   }
   
    
}